<?php

class DynamicData extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'DynamicData':
	 * @var integer $id
	 * @var string $page
	 * @var integer $position
	 * @var string $title
	 * @var string $alt
	 * @var string $url
	 * @var string $pic_path
	 * @var string $text
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'DynamicData';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('page','length','max'=>32),
			array('title','length','max'=>128),
			array('alt','length','max'=>128),
			array('url','length','max'=>256),
			array('pic_path','length','max'=>256),
			array('page, position', 'required'),
			array('position', 'numerical', 'integerOnly'=>true),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id'=>'Id',
			'page'=>'Page',
			'position'=>'Position',
			'title'=>'Title',
			'alt'=>'Alt',
			'url'=>'Url',
			'pic_path'=>'Pic Path',
			'text'=>'Text',
		);
	}
	
    public function safeAttributes()
	{
	    return array('title', 'alt', 'url', 'pic_path', 'text','position','page');
	}
}